import query from './atom/db/query';
import count from './atom/db/count';

declare const action_id: string;
declare const session_id: string;
declare const spaceid: string;

interface Message {
	default_val: string;
}

async function atom(msg: Message) {
	const systemid = '5981';
	const q = query(action_id, session_id, spaceid, systemid);
	q.prepare('exam', ['exam_id', 'exam_name', 'default_val', 'campus_id'], {}, 0, 1, [], []);
	const t = await q.exec();
	const arr = t[0].sort((s: any, t: any) => {
		return -s.default_val.localeCompare(t.default_val);
	});

	return arr;
}